import React, {Component} from 'react';
import {Button} from 'antd';
import {config} from "../config";
import moment from "moment";

class Index extends Component {
    constructor(props) {
        super(props);
        this.state = {
            data: [
                {
                    name: '我来接单',
                    path: '/orderTaking'
                },
                {
                    name: '我来配货',
                    path: '/distribution'
                },
                {
                    name: '我来对货',
                    path: '/checkOrder'
                },
                {
                    name: '我来入库',
                    path: '/storageManage'
                },
            ]
        }
    }

    render() {
        return (
            <div style={{paddingTop: '50px'}}>
                <div style={{textAlign: 'center', fontSize: '16px'}}>请选择身份</div>
                <div>
                    {
                        this.state.data.map((item, index) => {
                            return (
                                <div style={{textAlign: 'center', marginTop: '100px'}} key={index}>
                                    <Button style={{width: '300px', height: '45px', fontSize: '16px'}} type='primary'
                                            onClick={() => this.handleDrop(item.path)}>{item.name}</Button>
                                </div>
                            )
                        })
                    }
                </div>
            </div>
        )
    };

    componentDidMount() {
        window._this = this;
        let mom = moment(new Date("2018-08-01T02:12:23.000Z")).format("YYYYMMDDHHmmss");
        console.log(mom)
    }

    /**
     * 处理页面跳转
     * @param path
     */
    handleDrop(path) {
        this.props.history.push(config.path + path);
    }
}

export default Index;